
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@hscmap/magic-trackpad-detector
Advanced tools
* Apple's Magic trackpad emits *pseudo inertial* scroll event. This module determines wheter a wheel event is a **real** event (generated by a user's action)Ï or a **pseudo inertial** event. * [Working Demo](https://michitaro.github.io/magic-trackpad-dete
npm instasll --save @hscmap/magic-trackpad-detector
import { MagicTrackpadDetector } from "@hscmap/magic-trackpad-detector"
window.addEventListener('load', e => {
const trackpad = document.querySelector('.trackpad') as HTMLDivElement
const canvas = document.querySelector('canvas') as HTMLCanvasElement
const history: [number, boolean][] = []
const mtd = new MagicTrackpadDetector()
const historyCanvas = new HistoryCanvas(history, canvas)
trackpad.addEventListener('wheel', e => {
e.preventDefault()
history.unshift([e.deltaY, mtd.inertial(e)])
if (history.length > canvas.width)
history.splice(canvas.width)
historyCanvas.refresh()
})
historyCanvas.refresh()
})
class HistoryCanvas {
private ctx: CanvasRenderingContext2D
private w: number
private h: number
constructor(private history: [number, boolean][], canvas: HTMLCanvasElement) {
this.ctx = canvas.getContext('2d')!
this.w = canvas.width
this.h = canvas.height
}
refresh() {
this.clear()
this.drawInertialAreas()
this.drawAxis()
this.drawHistory()
}
private clear() {
this.ctx.clearRect(0, 0, this.w, this.h)
}
private drawInertialAreas() {
const ctx = this.ctx
let state = false
let start: number
this.history.push([0, false])
for (let x = 0; x < this.history.length; ++x) {
const [, i] = this.history[x]
if (state != i) {
if (state = i)
start = x
else {
ctx.fillStyle = '#ccf'
ctx.fillRect(start!, 0, x - start, this.h)
}
}
}
this.history.pop()
}
private drawHistory() {
const ctx = this.ctx
ctx.strokeStyle = '#f00'
ctx.beginPath()
for (let x = 0; x < this.history.length; ++x) {
const [y,] = this.history[x]
ctx.lineTo(x, y + this.h / 2)
}
ctx.stroke()
}
private drawAxis() {
const ctx = this.ctx
ctx.beginPath()
ctx.strokeStyle = '#777'
ctx.lineTo(0, this.h / 2)
ctx.lineTo(this.w, this.h / 2)
ctx.stroke()
}
}
FAQs
* Apple's Magic trackpad emits *pseudo inertial* scroll event. This module determines wheter a wheel event is a **real** event (generated by a user's action) or a **pseudo inertial** event. * [Working Demo](https://michitaro.github.io/magic-trackpad-detec
The npm package @hscmap/magic-trackpad-detector receives a total of 2 weekly downloads. As such, @hscmap/magic-trackpad-detector popularity was classified as not popular.
We found that @hscmap/magic-trackpad-detector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.